Optimal. Leaf size=142 \[ \frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {3 (-3 B+i A) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}-\frac {3 x (-3 B+i A)}{4 a^2}+\frac {(-B+i A) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.28, antiderivative size = 142, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {3595, 3525, 3475} \[ \frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {3 (-3 B+i A) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}-\frac {3 x (-3 B+i A)}{4 a^2}+\frac {(-B+i A) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3525
Rule 3595
Rubi steps
\begin {align*} \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx &=\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {\int \frac {\tan ^2(c+d x) (3 a (i A-B)+a (A+5 i B) \tan (c+d x))}{a+i a \tan (c+d x)} \, dx}{4 a^2}\\ &=\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}+\frac {\int \tan (c+d x) \left (-8 a^2 (A+2 i B)+6 a^2 (i A-3 B) \tan (c+d x)\right ) \, dx}{8 a^4}\\ &=-\frac {3 (i A-3 B) x}{4 a^2}+\frac {3 (i A-3 B) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {(A+2 i B) \int \tan (c+d x) \, dx}{a^2}\\ &=-\frac {3 (i A-3 B) x}{4 a^2}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}+\frac {3 (i A-3 B) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 7.09, size = 956, normalized size = 6.73 \[ \frac {i \sec (c) \sec ^2(c+d x) (-B \cos (2 c-d x)+B \cos (2 c+d x)-i B \sin (2 c-d x)+i B \sin (2 c+d x)) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{2 d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {x \sec (c+d x) (-\tan (c) A+i A-2 B-2 i B \tan (c)+(A+2 i B) (-\cos (2 c)-i \sin (2 c)) \tan (c)) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{(A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}-\frac {(2 A+3 i B) \cos (2 d x) \sec (c+d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{4 d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {\sec (c+d x) (A \cos (c)+2 i B \cos (c)+i A \sin (c)-2 B \sin (c)) \left (\tan ^{-1}(\tan (d x)) \sin (c)-i \tan ^{-1}(\tan (d x)) \cos (c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {\sec (c+d x) (A \cos (c)+2 i B \cos (c)+i A \sin (c)-2 B \sin (c)) \left (\frac {1}{2} \cos (c) \log \left (\cos ^2(c+d x)\right )+\frac {1}{2} i \sin (c) \log \left (\cos ^2(c+d x)\right )\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {(A+i B) \cos (4 d x) \sec (c+d x) \left (\frac {1}{16} \cos (2 c)-\frac {1}{16} i \sin (2 c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {(3 B-i A) \sec (c+d x) \left (\frac {3}{4} d x \cos (2 c)+\frac {3}{4} i d x \sin (2 c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {i (2 A+3 i B) \sec (c+d x) \sin (2 d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{4 d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {(B-i A) \sec (c+d x) \left (\frac {1}{16} \cos (2 c)-\frac {1}{16} i \sin (2 c)\right ) \sin (4 d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.52, size = 147, normalized size = 1.04 \[ \frac {{\left (-28 i \, A + 68 \, B\right )} d x e^{\left (6 i \, d x + 6 i \, c\right )} + {\left ({\left (-28 i \, A + 68 \, B\right )} d x - 8 \, A - 44 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (7 \, A + 11 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 16 \, {\left ({\left (A + 2 i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (A + 2 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + A + i \, B}{16 \, {\left (a^{2} d e^{\left (6 i \, d x + 6 i \, c\right )} + a^{2} d e^{\left (4 i \, d x + 4 i \, c\right )}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 1.09, size = 120, normalized size = 0.85 \[ -\frac {\frac {2 \, {\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (7 \, A + 17 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{2}} + \frac {16 \, B \tan \left (d x + c\right )}{a^{2}} - \frac {21 \, A \tan \left (d x + c\right )^{2} + 51 i \, B \tan \left (d x + c\right )^{2} - 22 i \, A \tan \left (d x + c\right ) + 74 \, B \tan \left (d x + c\right ) - 5 \, A - 27 i \, B}{a^{2} {\left (\tan \left (d x + c\right ) - i\right )}^{2}}}{16 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.19, size = 177, normalized size = 1.25 \[ -\frac {B \tan \left (d x +c \right )}{d \,a^{2}}-\frac {A \ln \left (\tan \left (d x +c \right )+i\right )}{8 d \,a^{2}}+\frac {i B \ln \left (\tan \left (d x +c \right )+i\right )}{8 d \,a^{2}}-\frac {A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {i B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}+\frac {5 i A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}-\frac {7 B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}-\frac {7 \ln \left (\tan \left (d x +c \right )-i\right ) A}{8 d \,a^{2}}-\frac {17 i \ln \left (\tan \left (d x +c \right )-i\right ) B}{8 d \,a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.41, size = 141, normalized size = 0.99 \[ \frac {\frac {\left (A+B\,2{}\mathrm {i}\right )\,1{}\mathrm {i}}{a^2}+\frac {B}{2\,a^2}-\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {5\,\left (A+B\,2{}\mathrm {i}\right )}{4\,a^2}-\frac {B\,3{}\mathrm {i}}{4\,a^2}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{8\,a^2\,d}-\frac {B\,\mathrm {tan}\left (c+d\,x\right )}{a^2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (7\,A+B\,17{}\mathrm {i}\right )}{8\,a^2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.98, size = 267, normalized size = 1.88 \[ \frac {2 i B}{- a^{2} d e^{2 i c} e^{2 i d x} - a^{2} d} + \begin {cases} \frac {\left (\left (4 A a^{2} d e^{2 i c} + 4 i B a^{2} d e^{2 i c}\right ) e^{- 4 i d x} + \left (- 32 A a^{2} d e^{4 i c} - 48 i B a^{2} d e^{4 i c}\right ) e^{- 2 i d x}\right ) e^{- 6 i c}}{64 a^{4} d^{2}} & \text {for}\: 64 a^{4} d^{2} e^{6 i c} \neq 0 \\x \left (- \frac {- 7 i A + 17 B}{4 a^{2}} - \frac {\left (7 i A e^{4 i c} - 4 i A e^{2 i c} + i A - 17 B e^{4 i c} + 6 B e^{2 i c} - B\right ) e^{- 4 i c}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (7 i A - 17 B\right )}{4 a^{2}} + \frac {\left (A + 2 i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a^{2} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________